// 使用redux 建文件夹 使用
// createStore  用来创建redux仓库
// combineReducers  用来合并多个reducer
import { legacy_createStore as createStore, combineReducers } from "redux";

import userReducer from "./reducer/userReducer";
import cartReducer from "./reducer/cartReducer";
// 合并reducer
let reducer = combineReducers({
  cartReducer,
  userReducer,
});
// 合并reducer之后  获取状态时  需要使用store.getState().cartReducer.属性名
let store = createStore(
  reducer,
  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);

export default store;
